package mest.service.cxj.impl;

import mest.Dto.cxj.WorkRouteDto;
import mest.dao.cxj.WorkRouteDao;
import mest.entity.work_route;
import mest.service.cxj.WorkRouteService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class WorkRouteServiceImpl implements WorkRouteService {

    @Resource
    private WorkRouteDao workRouteDao;


    @Override
    public boolean insertWorkRoute(work_route workRoute,String theirDb) {
        boolean flag = false;
        int num = workRouteDao.insertWorkRoute(workRoute,theirDb);
        if (num > 0) {
            flag = true;
        }
        return flag;
    }

    @Override
    public List<WorkRouteDto> selectAllWorkRouteAndSave(Integer page, Integer limit, String routeName,String theirDb) {
        return workRouteDao.selectAllWorkRouteAndSave((page - 1) * limit, limit, routeName,theirDb);
    }


    @Override
    public Integer selectCountWorkRoute(String routename,String theirDb) {
        return workRouteDao.selectCountWorkRoute(routename,theirDb);
    }

    @Override
    public boolean deleteWorkRoute(Integer id,String theirDb) {
        boolean flag = false;
        int num = workRouteDao.deleteWorkRoute(id,theirDb);
        if (num > 0) {
            flag = true;
        }
        return flag;
    }


}
